#ifndef VIEWSCENE_HPP
#define VIEWSCENE_HPP
#include "ViewTransform.hpp"
#include <vector>
#include <boost/signal.hpp>
class MeshView;
// Contains loaded meshes, maintains the selected mesh
class ViewScene
{
public:
   ViewScene();
   static ViewScene& GetInstance();
   
   ViewTransform     mTransform;
   // Loads the projection matrix.  aOffsetValue = 1.0 for normal projection.
   // values slightly larger than 1.0 can help raise geometry in z-buffer
   void LoadProjection(float aOffsetValue);

   void AddMesh(MeshView* aMesh);
   void SetActiveMesh(int aIndex);
   void MoveMesh(MeshView* aMeshPtr, int aMoveOffset);
   int GetMeshIndex(MeshView* aMeshPtr);
   void SetSelectedMesh(int aIndex);
   void SetSelectedMesh(MeshView* aMeshPtr);
   
   MeshView* GetSelectedMesh();
   int GetSelectedMeshIndex() { return mSelectedMesh; }
   void Remove(MeshView* aMeshPtr);
   void Draw();
   std::vector<MeshView*> mModels;

   static boost::signal<void ()> SelectedVertsChanged;
   static boost::signal<void ()> SelectedMeshChanged;
   enum SelectionMode
   {
      cVERTEX,
      cLOOP,
      cINTERFACE,
      cFACE,
      cEDGE_PATCH
   };
   
   void SetSelectionMode(SelectionMode aMode) { mSelectionMode = aMode; }
   SelectionMode GetSelectionMode() const { return mSelectionMode; }

private:
   void DrawModels();
   int mSelectedMesh;   
   SelectionMode     mSelectionMode;
};

#endif // VIEWSCENE_HPP